package com.example.mansystem.controller;


import com.example.mansystem.dto.ChangeDepartmentDto;
import com.example.mansystem.entity.CallResultMsg;
import com.example.mansystem.exception.UniformReponseHandler;
import com.example.mansystem.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @PostMapping("/change")
    public CallResultMsg ChangeDepartment(@RequestBody @Validated ChangeDepartmentDto validator)
    {
        departmentService.ChangeDepartment(validator);
        return new UniformReponseHandler<String>().sendSuccessResponse("SUCCESS");
    }
}
